package org.vanjor.db;
import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.vanjor.db.po.User;
 
public class UserDemo {  
    public static void main(String[] args) throws IOException {  
        String resource = "org/vanjor/db/Configuration.xml";  
        Reader reader = Resources.getResourceAsReader(resource);  
        SqlSessionFactory sqlMapper = new SqlSessionFactoryBuilder().build(reader);  
        SqlSession session = sqlMapper.openSession();  
        User user = (User) session.selectOne("org.vanjor.db.po.User.selectUser", 0);  
        System.out.println(user.getName());  
    }  
} 
